<script setup>
import search_svg from "../assets/images/student/search.svg"
import { ref } from 'vue';

const props =  defineProps(['query', 'placeholder'])
const emit = defineEmits(['update:query'])


const search_query = ref('')

function updateQuery() {
    emit('update:query', search_query.value)
}

</script>

<template>
    <div class="search-bar">
       <input type="text" :placeholder="props.placeholder" v-model="search_query" />
       <img :src="search_svg" alt="Search" style="width: 28px;" @click="updateQuery" >
    </div>
</template>


<style scoped >
.search-bar {
    /* width: 602px; */
    height: 50px;
    display: block;
    /* display: flex; */
    /* justify-content: space-around; */
    /* align-items: center; */
    background-color: #ffffff;
    box-shadow: 0px 3px 6px 0px 
		rgba(0, 0, 0, 0.16);
	border-radius: 10px;
    position: relative;
}

.search-bar > input {
    /* width: 500px; */
    position: absolute;
    top: 0;
    left: 28px;
    background-color: transparent;
    border: none;
    outline: none;
    font-size: 16px;
    font-family: Source Han Sans CN;
    padding: 16px 0;
}


.search-bar > img {
    display: block;
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 18px;
}



</style>